package com.hkts.naturalgas.base.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.naturalgas.base.entity.CalcinationDesulfurizationDenitration;
import com.hkts.naturalgas.base.service.*;
import com.hkts.naturalgas.config.HttpTask;
import com.hkts.naturalgas.model.CaseValue;
import com.hkts.naturalgas.utils.CustomPageUtils;
import com.hkts.naturalgas.utils.Result;
import com.hkts.naturalgas.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/instrumentdata/all")
public class AllController {

    @Autowired
    private ICalcinationDesulfurizationDenitrationService iCalcinationDesulfurizationDenitrationService;

    @Autowired
    private ICalcinationPurificationBleachingService iCalcinationPurificationBleachingService;

    @Autowired
    private ICalcinationPurifyWetElectricityService iCalcinationPurifyWetElectricityService;

    @Autowired
    private IHktsTailGasService iHktsTailGasService;

    @Autowired
    private IHktsWasteGasService iHktsWasteGasService;

    @Autowired
    private IOzoneService iOzoneService;

    @Autowired
    private IRoastingDesulphurizingService iRoastingDesulphurizingService;

    @Autowired
    private IRoastingDustService iRoastingDustService;

    @Autowired
    private IRoastingPurificationBleachingService iRoastingPurificationBleachingService;

    @Autowired
    private IRoastingoneRsoneRsjoneService iRoastingoneRsoneRsjoneService;

    @Autowired
    public IRoastingonePyjoneService iRoastingonePyjoneService;
    @Autowired
    public IRoastingonePyjtwoService iRoastingonePyjtwoService;
    @Autowired
    public IRoastingoneRsoneRsjtwoService iRoastingoneRsoneRsjtwoService;
    @Autowired
    public IRoastingoneRsoneRsjthreeService iRoastingoneRsoneRsjthreeService;
    @Autowired
    public IRoastingoneRstwoRsjoneService iRoastingoneRstwoRsjoneService;
    @Autowired
    public IRoastingoneRstwoRsjtwoService iRoastingoneRstwoRsjtwoService;
    @Autowired
    public IRoastingoneRstwoRsjthreeService iRoastingoneRstwoRsjthreeService;
    @Autowired
    private ILayoutService iLayoutService;
    @Autowired
    private IRoastingtwoRsoneRsjoneService iRoastingtwoRsoneRsjoneService;
    @Autowired
    private IRoastingtwoRsoneRsjtwoService iRoastingtwoRsoneRsjtwoService;
    @Autowired
    private IRoastingtwoRsoneRsjthreeService iRoastingtwoRsoneRsjthreeService;
    @Autowired
    private IRoastingtwoRstwoRsjoneService iRoastingtwoRstwoRsjoneService;
    @Autowired
    private IRoastingtwoRstwoRsjthreeService iRoastingtwoRstwoRsjthreeService;
    @Autowired
    private IRoastingtwoRstwoRsjtwoService iRoastingtwoRstwoRsjtwoService;
    @Autowired
    public IRoastingtwoPyjoneService iRoastingtwoPyjoneService;
    @Autowired
    public IRoastingtwoPyjtwoService iRoastingtwoPyjtwoService;

    @Resource
    private HttpAPIService httpAPIService;

    @Autowired
    private IRoastingPurifyWetElectricityService iRoastingPurifyWetElectricityService;
    @GetMapping("/getPageByTime")
    public Result<Object> getPageByTime(Page page, String startDate, String endDate,String type){

        switch (type){
            case CaseValue.煅烧脱硫脱硝:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iCalcinationDesulfurizationDenitrationService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.煅烧净化脱白:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iCalcinationPurificationBleachingService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.煅烧净化湿电:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iCalcinationPurifyWetElectricityService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.煅烧尾气:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iHktsTailGasService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧废气:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iHktsWasteGasService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.臭氧:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iOzoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧脱硫:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingDesulphurizingService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧除尘:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingDustService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧净化脱白:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingPurificationBleachingService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧净化湿电:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingPurifyWetElectricityService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧1_燃烧架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRsoneRsjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧1_燃烧架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRsoneRsjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧1_燃烧架3:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRsoneRsjthreeService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_排烟架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingonePyjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧2_燃烧架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRstwoRsjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧2_燃烧架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRstwoRsjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_燃烧2_燃烧架3:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingoneRstwoRsjthreeService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧1_排烟架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingonePyjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧1_燃烧架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRsoneRsjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧1_燃烧架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRsoneRsjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧1_燃烧架3:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRsoneRsjthreeService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_排烟架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoPyjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧2_燃烧架1:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRstwoRsjoneService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧2_燃烧架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRstwoRsjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_燃烧2_燃烧架3:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoRstwoRsjthreeService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.焙烧2_排烟架2:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iRoastingtwoPyjtwoService.selectPageByTime(page,startDate,endDate)));
            case CaseValue.煅烧排料:
                return ResultUtil.data(CustomPageUtils.getCustomPage(iLayoutService.selectPageByTime(page,startDate,endDate)));
            default :
                return ResultUtil.error("未知参数！");
        }

    }
    @GetMapping("/getBrokenLineGraph")
    public Result<Object> getBrokenLineGraph(Page page, String startDate, String endDate,String type){

        switch (type){
            case CaseValue.煅烧脱硫脱硝:
                return ResultUtil.data(iCalcinationDesulfurizationDenitrationService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.煅烧净化脱白:
                return ResultUtil.data(iCalcinationPurificationBleachingService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.煅烧净化湿电:
                return ResultUtil.data(iCalcinationPurifyWetElectricityService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.煅烧尾气:
                return ResultUtil.data(iHktsTailGasService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧废气:
                return ResultUtil.data(iHktsWasteGasService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.臭氧:
                return ResultUtil.data(iOzoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧脱硫:
                return ResultUtil.data(iRoastingDesulphurizingService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧除尘:
                return ResultUtil.data(iRoastingDustService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧净化脱白:
                return ResultUtil.data(iRoastingPurificationBleachingService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧净化湿电:
                return ResultUtil.data(iRoastingPurifyWetElectricityService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧1_燃烧架1:
                return ResultUtil.data(iRoastingoneRsoneRsjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧1_燃烧架2:
                return ResultUtil.data(iRoastingoneRsoneRsjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧1_燃烧架3:
                return ResultUtil.data(iRoastingoneRsoneRsjthreeService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_排烟架1:
                return ResultUtil.data(iRoastingonePyjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧2_燃烧架1:
                return ResultUtil.data(iRoastingoneRstwoRsjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧2_燃烧架2:
                return ResultUtil.data(iRoastingoneRstwoRsjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_燃烧2_燃烧架3:
                return ResultUtil.data(iRoastingoneRstwoRsjthreeService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧1_排烟架2:
                return ResultUtil.data(iRoastingonePyjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧1_燃烧架1:
                return ResultUtil.data(iRoastingtwoRsoneRsjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧1_燃烧架2:
                return ResultUtil.data(iRoastingtwoRsoneRsjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧1_燃烧架3:
                return ResultUtil.data(iRoastingtwoRsoneRsjthreeService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_排烟架1:
                return ResultUtil.data(iRoastingtwoPyjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧2_燃烧架1:
                return ResultUtil.data(iRoastingtwoRstwoRsjoneService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧2_燃烧架2:
                return ResultUtil.data(iRoastingtwoRstwoRsjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_燃烧2_燃烧架3:
                return ResultUtil.data(iRoastingtwoRstwoRsjthreeService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.焙烧2_排烟架2:
                return ResultUtil.data(iRoastingtwoPyjtwoService.getBrokenLineGraph(page,startDate,endDate));
            case CaseValue.煅烧排料:
                return ResultUtil.data(iLayoutService.getBrokenLineGraph(page,startDate,endDate));
            default :
                return ResultUtil.error("未知参数！");
        }

    }
    @GetMapping("/saveData")
    public String saveData() throws Exception {
        return httpAPIService.doGet("http://192.168.99.67:5000/biz");
    }
}
